package com.woniuxy.controller;

import com.woniuxy.entity.FormData;
import com.woniuxy.entity.Patient;
import com.woniuxy.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author g2l
 * @create 2022-07-10 15:37
 */
@RestController
public class PatientController {
    @Autowired
    private PatientService service;

    @PostMapping("/insertPatient")
    public void insertPatient(@RequestBody FormData formData){
        Patient patient = new Patient();
        patient.setPatientId(0);
        patient.setPatientName(formData.getName());
        patient.setPatientGender(formData.getGender());
        patient.setPatientAge(formData.getAge());
        patient.setPatientPhoneNum(formData.getPhoneNum());
        patient.setPatientDesc(formData.getDesc());
        service.insertPatient(patient);

    }

}
